<header>
    <title>用户{notempty name="goods"}修改{else /}添加{/notempty}</title>
</header>
{include file="public/header" /}
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">

            <form class="layui-form" action="" method="post">
                {notempty name="goods"}<input type="hidden" name="id" value="{$goods.id}">{/notempty}
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名：</label>
                    <div class="layui-input-block">
                        <input style="width:190px;" type="text" name="user_name" {notempty name="goods"}value="{$goods.user_name}"{/notempty} required  lay-verify="required"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码：</label>
                    <div class="layui-input-block">
                        <input style="width:190px;" type="password" name="user_pwd" {notempty name="goods"}value="{$goods.user_pwd}"{/notempty} required  lay-verify="required"  placeholder="请输入用户密码" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">年龄：</label>
                    <div class="layui-input-block">
                        <input style="width:190px;" type="text" name="age" {notempty name="goods"}value="{$goods.age}"{/notempty} required  lay-verify="required"  placeholder="请输入年龄" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">单选框</label>
                    <div class="layui-input-block">
                        <input type="radio" name="sex" value="0" title="男"{notempty name="goods"}{if $goods['sex']==0}checked{/if}{/notempty}>
                        <input type="radio" name="sex" value="1" title="女"{notempty name="goods"}{if $goods['sex']==1}checked{/if}{/notempty}>
                    </div>
                </div>

                <br>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>

            <script>
                $(function () {
                   $("input[name='age']").blur(function () {
                       if($(this).val()>100||$(this).val()<0){
                           layer.alert('年龄不合法', {
                               icon: 2,
                               skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
                           })
                       }
                   });

                })
            </script>

            <script>
                //Demo
                layui.use('form', function(){
                    var form = layui.form;

                    //监听提交
                    form.on('submit(formDemo)', function(data){

                    });
                });
            </script>
            {include file="public/footer" /}